window.onload = function() {
			size=document.body.clientWidth/30;
			document.getElementsByTagName("html")[0].style.fontSize = size+"px";
			
			var canvas = document.getElementById("canvas");
			canvas.width = document.body.clientWidth;
			canvas.height = document.body.clientHeight;
			
			var snow_x = new Array();
			var snow_y = new Array();
			var fontSizes = new Array();
			for(var i = 0 ; i < 300 ; i++){
				snow_x[i] = Math.random()*canvas.width;
				snow_y[i] = -1*Math.random()*canvas.height;
				fontSizes[i] = Math.random()*30+20;
			}

			//获取context2d
			var context = canvas.getContext("2d");
			context.fillStyle = "#FFFFFF";
			//setInterval可以定时执行操作
			var speedy = 10;
			var speedx = 5;
			setInterval(function(){
				context.clearRect(0,0,canvas.width,canvas.height);
				for(var i = 0 ; i < 300 ; i++){
					snow_y[i] = snow_y[i] + speedy ;
					if(snow_y[i]>canvas.height){
						snow_y[i] = -1*Math.random()*canvas.height;
					} 
					context.font = fontSizes[i]+"px arial";
					context.fillText("*",snow_x[i],snow_y[i]);
				}
			},50);
			
	//添加事件
	var page1 = document.getElementById("page1");
	var page2 = document.getElementById("page2");
    var page3 = document.getElementById("page3");
    var page4 =document.getElementById("page4");
//	var light = document.getElementById("light");
//	light.addEventListener("touchstart", function() {
		setTimeout(function(){
			page1.style.display = "none";
			page2.style.display = "block";
			page3.style.display = "none";
	        page4.style.display = "none";
	}, 5000);
	
	
    var wenzi = document.getElementById("wenzi");
	wenzi.addEventListener("touchstart",function(){
		setTimeout(function(){
			page1.style.display="none";
			page2.style.display = "none";
			page3.style.display = "block";
			page4.style.display = "none";
		},3000);
		page2.setAttribute("class","page2_2");
		player.pause();
	},false);
	
	
	var video = document.getElementById("video");
	var bnl = document.getElementById("p2_bainian");
	bnl.addEventListener("touchstart",function(){
		video.style.display = "block";
		video.play();
	},false);
	
	video.addEventListener("ended",function(){
		page1.style.display = "none";
		page2.style.display = "none";
		page3.style.display = "none";
		page4.style.display = "block";
	},false);


}